home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr27 / fm2utls2.zip / SDIR.CMD < prev    next >
OS/2 REXX Batch file  |  1995-03-06  |  2KB  |  77 lines

  1. /*
  2.  * show a directory including .SUBJECT EAs
  3.  * SDIR /? for help.
  4.  */
  5.  
  6. '@echo off'
  7. parse arg mask recurse
  8. mask = strip(mask)
  9. if mask = '/?' then
  10. do
  11.   say 'SDIR is a DIR-like command that shows .SUBJECT EAs in its display.'
  12.   say ''
  13.   say 'Usage: SDIR mask /s'
  14.   say ''
  15.   say ' Both mask and /s are optional.  mask filters the files/directories shown'
  16.   say ' and may contain wildcard characters ? and *.  /s is a switch meaning to'
  17.   say ' recurse into subdirectories, and cannot be used if mask contains spaces'
  18.   say ' (in which case mask should be surrounded with quotes).  If you use /s,'
  19.   say ' you must also give mask.  Order of parameters is enforced.'
  20.   say ''
  21.   say 'Examples:  SDIR *.exe'
  22.   say '           SDIR d:\*.zip /s'
  23.   say '           SDIR 'd2c(34)'long filename number *'d2c(34)
  24.   say ''
  25.   say 'Hector wuz here.'
  26.   exit
  27. end
  28. if left(mask,1) = d2c(34) then
  29. do
  30.   recurse = ''
  31.   parse arg mask
  32.   mask = substr(mask,2)
  33.   if right(mask,1) = d2c(34) then
  34.     mask = left(mask,length(mask) - 1)
  35. end
  36. if mask = '' then
  37.   mask = '*'
  38. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  39. call SysLoadFuncs
  40. recurse = translate(recurse)
  41. if recurse = '/S' then
  42.   rc = SysFileTree(mask,filename,'S')
  43. else
  44. do
  45.   recurse = ''
  46.   rc = SysFileTree(mask,filename)
  47. end
  48. if rc = 0 then
  49. do
  50.   do i=1 to filename.0
  51.     parse var filename.i fdate ftime fsize fattr fname
  52.     filename.i = left(filename.i,length(filename.i) - length(fname))
  53.     fname = strip(fname)
  54.     if recurse = '' then
  55.     do
  56.       lpos = lastpos('\',fname)
  57.       if lpos \= 0 then
  58.         rname = substr(fname,lpos + 1)
  59.       else
  60.         rname = fname
  61.     end
  62.     else
  63.       rname = fname
  64.     say filename.i'  'rname
  65.     if SysGetEA(fname,'.SUBJECT','text') = 0 then
  66.     do
  67.       text = substr(text,5)
  68.       text = strip(text)
  69.       if text \= '' then
  70.         say '  +'text
  71.     end
  72.   end
  73. end
  74. else
  75.   say 'Out of memory.'
  76. exit
  77.